EEG-guided sleep protection